package com.yzy.fly.entity.core;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yzy.fly.jarPackage.ClassFileAccess;
import com.yzy.fly.type.FileType;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
@TableName(value = "fly_class")
public class FlyClass implements Serializable,ClassFileAccess {
    @TableId(type = IdType.AUTO)
    private Integer id;
    private int version;
    private int access;
    private String packageName;
    private String className;
    private String name;
    private String signature;
    private String superName;
    private String interfaces;
    @TableField(exist = false)
    private List<FlyClassAnnotation> annotationList;
    @TableField(exist = false)
    private List<FlyField> fieldList;
    @TableField(exist = false)
    private List<FlyMethod> methodList;

    @TableField(exist = false)
    private String label;

    @Override
    public String getFileName() {
        return getClassName();
    }

    @Override
    public String getFileSuffix() {
        return FileType.CLASS.getValue();
    }

    @Override
    public String getFilePath() {
        return (getPackageName()+ "."+ getClassName()).replace(".","/");
    }

    @Override
    public String getFileFullPath() {
        return getFilePath() + getFileSuffix();
    }

    public String getLabel(){
        return name;
    }
}
